#! /bin/bash
last_year=$(date -d "-1 month" "+%Y")
mysql -h192.168.52.150 -P3306 -uroot -p123456 -Dscrm_bi -e "delete from customer_signup_app where payment_time_year = "${last_year}""

sqoop export \
--connect "jdbc:mysql://192.168.52.150:3306/scrm_bi?useUnicode=true&characterEncoding=utf-8" \
--username root \
--password 123456 \
--table customer_signup_app \
--hcatalog-database itcast_dws \
--hcatalog-table customer_signup_dws \
--hcatalog-partition-keys payment_time_year  \
--hcatalog-partition-values ${last_year}  \
-m 10